/**
 * Policy Mappings
 * (sails.config.policies)
 *
 * Policies are simple functions which run **before** your actions.
 *
 * For more information on configuring policies, check out:
 * https://sailsjs.com/docs/concepts/policies
 */

const UserController = require("../api/controllers/UserController");
const RecordController = require("../api/controllers/RecordController")

module.exports.policies = {

  /***************************************************************************
  *                                                                          *
  * Default policy for all controllers and actions, unless overridden.       *
  * (`true` allows public access)                                            *
  *                                                                          *
  ***************************************************************************/

  // '*': true,
  '*': 'isLoggedIn',

  UserController: {
    "*": 'isAdmin',   // 管理员权限
    register: true,
    login: true,
    logout: true,
    registerSuperUser: true,
    getUserCount: true,
    getCurrentUser: true,
    getAdminCount: true
  },
  RecordController: {
    "*": 'isDoctor',
    '*': 'isLoggedIn',
  }
};
